﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForm2
{
    public partial class ChangeForm : Form
    {
        public ChangeForm()
        {
            InitializeComponent();
        }

        private int _id;
        private string _studentName;
        private int _age;
        private int _score;

        public ChangeForm(int id, string studentName, string age,string score)
        {
            InitializeComponent();
            this._id = id;
            NewName.Text = studentName;
            NewAgeTxt.Text = age.ToString() ;
            NewScore.Text = score.ToString();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var sqlUpdate = string.Format("Update Student set StudentName='{0}',Score='{1}',Age='{2}' where StudentName='{0}'",NewName.Text,NewScore.Text,NewAgeTxt.Text);
            var dt = DBhelp.GetDataTable(sqlUpdate);
            this.Close();
        }

        private void ChangeForm_Load(object sender, EventArgs e)
        {

        }
    }
}
